<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>
        <input type='text' class='input'>
        <button class="btn">搜索</button>
        <ul class="song-list"></ul>
    </div>
<script >
const API ='https://music.niubishanshan.top/api/v2/music/search/json'

const input = document.querySelector('.input')
const btn = document.querySelector('.btn')
const ul= document.querySelector('.song-list')

const ajax = ({ type,url,success,error} = {}) =>{
  const req = new XMLHttpRequest()
  req.onreadystatechange = function () {
    if (req.readyState === 4){
      if(req.status >= 200 && req.status < 300|| req.status ===304){
        const json = JSON.parse(req.responseText)
        const {data} = json
        const {songList} = data
        const idList = songList.map(e => e.songListMid)
        const html = idList.map(str => '<li>${str}</li>').join
        ul.innerHTML = html
      }else{
        console.log('请求错误')
      }
    }
  }
  req.send()

}

</script>
</body>
</html>